<%layout("/eova/layout/list.html",{'title' : 'Eova Office'}){%>

<div class="eova-layout" style="width: calc(100% - 20px); height: calc(100% - 20px); margin: 10px;">
	<div class="zone" style="width: 100%; height: 100%;">
		<div class="box" style="height: 30px; padding: 5px;">
		
			<div class="layui-btn-container" id="toolbar">
				<button class="layui-btn layui-btn-sm" onclick="eova_download()">
					<i class="layui-icon eova-icon-download-circle"></i> 下载文件
				</button>
				<button class="layui-btn layui-btn-sm" onclick="eova_print()">
					<i class="layui-icon eova-icon-print"></i> 在线打印
				</button>
				<%// 自定义功能按钮%>
				<%if(!isEmpty(btnList!)){%>
					<%for(btn in btnList){%>
						<%include(btn.ui,{'menu': menu, 'button': btn}){}%>
					<%}%>
				<%}%>
				<%// 仅超级管理员可见%>
				<%if(loginUser.isAdmin){%>
					<%include("/eova/button/btn/quick.html",{'menu': menu}){}%>
				<%}%>
			</div>
		
		</div>
		<div class="box" style="height: calc(100% - 2px - 40px); top: calc(2px + 30px)">
			<iframe id="show" src="/office/show/${para}" allowtransparency="true" style="border: 0; width: 100%; height: 98.5%;" frameborder="0"></iframe>
			<iframe id="print" style="height: 0;width: 0"></iframe>
		</div>
	</div>
</div>
<script type="text/javascript">
	function eova_download() {
		window.open('/office/file/${para}');
	}
	function eova_print() {
		var show = document.getElementById('show');
		var print = document.getElementById('print');
		
		// 保证打印内容按正常比例打印
		print.contentWindow.document.head.innerHTML = show.contentWindow.document.head.innerHTML
		print.contentWindow.document.body.innerHTML = show.contentWindow.document.body.innerHTML
		print.contentWindow.focus();
		print.contentWindow.print();
	}
</script>

<%}%>
